
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int i;
    int seed = 1000;
    int numPlayer = 2;
    int r;
    int loopCount = 100;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int result;
    int hand = 4;
    int bonus = 0;
    int numCards;
    int randomNumber;
    int expectedCards;
    
    
    
#if (NOISY_TEST == 1)
                printf ("TESTING adventurer():\n"); // testing for number of cards
                
#endif
        for(i = 0; i < loopCount; i++){
                memset(&G, 23, sizeof(struct gameState));   // clear the game state
                r = initializeGame(numPlayer, k, seed, &G); // initialize a new game


                randomNumber = rand() % 30;
                *G.handCount = randomNumber;

                //printf("cards %d\n", *G.handCount);

                result=cardEffect(adventurer, 0, 0, 0, &G, hand, &bonus);
                numCards = *G.handCount;              // set the number of cards on hand
                
                expectedCards = randomNumber + 2;

#if (numCards == expectedCards)
                printf("Number of Cards = %d, Expected number of Cards = %d\n", numCards, expectedCards);
            
#endif
            assert(numCards == expectedCards); // check if the number of cards is correct
            
        

        }
    printf("All tests passed!\n");

    return 0;
}
